/* Advanced Calendar View Styles */
.advanced-calendar-view {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ICS Event Styles */
.fc-event[data-ics-event="true"] {
    opacity: 0.9;
    border-radius: 4px;
}

.fc-event[data-ics-event="true"]:before {
    content: "📅";
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    opacity: 0.7;
}

.fc-event[data-ics-event="true"]:hover {
    opacity: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ICS Event Info Modal */
.ics-event-description {
    max-height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.9em;
    margin-top: 0.25rem;
    padding: 0.5rem;
    background: var(--background-secondary);
    border-radius: 4px;
}

/* ICS Context Menu */
.ics-event-context-menu {
    font-size: 0.9em;
}

.ics-context-menu-item:hover {
    background-color: var(--background-modifier-hover) !important;
}

/* Timeblock Help Text */
.advanced-calendar-view__help-text {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--background-secondary);
    border-radius: 4px;
    border-left: 3px solid var(--color-accent);
}

/* Event Type Specific Styles */

/* Timeblock Events */
.fc-timeblock-event,
.fc-event[data-event-type="timeblock"] {
    opacity: 0.9;
    border-radius: 6px;
    border-width: 2px !important;
    border-style: solid !important;
}

.fc-timeblock-event:hover,
.fc-event[data-event-type="timeblock"]:hover {
    opacity: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

/* Task Events */
.fc-task-event {
    border-radius: 4px;
    border-width: 1px !important;
}

.fc-task-event:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* ICS Events */
.fc-ics-event {
    border-radius: 4px;
    border-width: 2px !important;
    border-style: solid !important;
}

.fc-ics-event:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Recurring Events */
.fc-recurring-event {
    border-style: dashed !important;
}

/* Completed Events */
.fc-completed-event {
    opacity: 0.7;
}

/* Timeblock Modal Styles */
.timeblock-creation-modal .modal-content {
    max-width: 500px;
}

.timeblock-date-display {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--background-secondary);
    border-radius: 6px;
    text-align: center;
}

.timeblock-time-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.timeblock-modal-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.timeblock-help-text {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--background-secondary);
    border-radius: 4px;
    line-height: 1.4;
}

.timeblock-help-text code {
    background: var(--background-primary);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Attachment Selection Styles */
.timeblock-attachments-list {
    margin-top: 0.5rem;
    min-height: 2rem;
}

.timeblock-attachments-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9em;
    padding: 0.5rem;
    text-align: center;
    background: var(--background-secondary);
    border-radius: 4px;
}

.timeblock-attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--background-secondary);
    border-radius: 4px;
    border: 1px solid var(--background-modifier-border);
}

.timeblock-attachment-item:hover {
    background: var(--background-modifier-hover);
}

.timeblock-attachment-info {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.timeblock-attachment-name {
    font-weight: 500;
    color: var(--text-normal);
    display: block;
}

.timeblock-attachment-path {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 0.2rem;
    word-break: break-all;
}

.timeblock-attachment-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2em;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.timeblock-attachment-remove:hover {
    background: var(--background-modifier-error);
    color: var(--text-on-accent);
}

/* Attachment Suggestion Modal Styles */
.attachment-suggestion {
    padding: 0.5rem;
}

.attachment-name {
    font-weight: 500;
    color: var(--text-normal);
}

.attachment-path {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Timeblock Info Modal */
.timeblock-description {
    max-height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.9em;
    margin-top: 0.25rem;
    padding: 0.5rem;
    background: var(--background-secondary);
    border-radius: 4px;
}

.timeblock-attachments {
    margin-top: 0.5rem;
}

.timeblock-attachment-item {
    margin-bottom: 0.25rem;
}

.timeblock-attachment-item .internal-link {
    color: var(--link-color);
    text-decoration: none;
    cursor: pointer;
}

.timeblock-attachment-item .internal-link:hover {
    text-decoration: underline;
}

/* ICS Subscription Settings */
.ics-subscription-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--background-modifier-border);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.settings-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.settings-status-indicator.enabled {
    background-color: var(--text-success);
}

.settings-status-indicator.enabled.error {
    background-color: var(--text-error);
}

.settings-status-indicator.disabled {
    background-color: var(--text-muted);
}

.ics-subscription-info {
    flex: 1;
    min-width: 0;
}

.ics-subscription-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.ics-subscription-url {
    font-size: 0.85em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.ics-subscription-meta {
    font-size: 0.8em;
    color: var(--text-muted);
}

.ics-subscription-error {
    font-size: 0.8em;
    color: var(--text-error);
    margin-top: 0.25rem;
}

.ics-subscription-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Use consistent button system */
.ics-subscription-actions button {
    background: transparent;
    color: var(--text-normal);
    border: none;
    box-shadow: none;
    font-size: 0.8em;
}

.ics-subscription-actions button:hover {
    background: var(--tn-interactive-hover);
}

.ics-subscription-toggle.enabled {
    color: var(--text-success);
    border-color: var(--text-success);
}

.ics-subscription-toggle.disabled {
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.ics-subscription-delete {
    color: var(--text-error) !important;
    border-color: var(--text-error) !important;
}

.ics-subscription-delete:hover {
    background: var(--text-error) !important;
    color: white !important;
}

/* ICS Subscription Forms */
.ics-add-subscription-form,
.ics-edit-form {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--background-modifier-border);
    border-radius: 4px;
    background: var(--background-secondary);
}

.ics-form-row,
.ics-edit-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ics-form-row-multi,
.ics-edit-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.ics-form-group,
.ics-edit-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 120px;
}

.ics-form-label,
.ics-edit-label {
    min-width: 80px;
    font-weight: 500;
    flex-shrink: 0;
}

.ics-form-input,
.ics-edit-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--background-modifier-border);
    border-radius: 3px;
    background: var(--background-primary);
    color: var(--text-normal);
}

.ics-form-color,
.ics-edit-color {
    width: 40px;
    height: 30px;
    border: 1px solid var(--background-modifier-border);
    border-radius: 3px;
    cursor: pointer;
}

.ics-form-number,
.ics-edit-number {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--background-modifier-border);
    border-radius: 3px;
    background: var(--background-primary);
    color: var(--text-normal);
}

.ics-form-checkbox-label,
.ics-edit-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.ics-form-checkbox,
.ics-edit-checkbox {
    margin: 0;
}

/* Use consistent button system */
.ics-form-button,
.ics-edit-button {
    background: transparent;
    color: var(--text-normal);
    border: none;
    box-shadow: none;
    margin-right: 0.5rem;
}

.ics-form-button:hover,
.ics-edit-button:hover {
    background: var(--tn-interactive-hover);
}

.ics-form-button.mod-cta,
.ics-edit-button.mod-cta {
    background: var(--interactive-accent);
    color: var(--text-on-accent);
    border: none;
    box-shadow: none;
}

.ics-form-button.mod-cta:hover,
.ics-edit-button.mod-cta:hover {
    background: var(--interactive-accent-hover);
    box-shadow: none;
}

.ics-edit-buttons {
    justify-content: flex-start;
    margin-top: 0.5rem;
}

.ics-subscription-editing {
    background: var(--background-secondary);
    border-color: var(--interactive-accent);
}

.advanced-calendar-view__container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.advanced-calendar-view__header {
    padding: 0.5rem 1rem;
    background: var(--background-primary);
    flex-shrink: 0;
}

.advanced-calendar-view__main-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.advanced-calendar-view__main-row .filter-bar-container {
    flex: 1;
    min-width: 300px;
}

.advanced-calendar-view__controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.advanced-calendar-view__schedule-tasks-btn {
    padding: 0.4rem 0.8rem;
    background: var(--interactive-accent);
    color: var(--text-on-accent);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.advanced-calendar-view__schedule-tasks-btn:hover {
    background: var(--interactive-accent-hover);
}

.advanced-calendar-view__calendar-container {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--background-modifier-border);
    border-radius: var(--tn-radius-md);
    min-height: 0;
}

/* FullCalendar overrides - Minimalist & Clean */
.advanced-calendar-view .fc {
    height: 100%;
    font-family: var(--font-interface);
}

/* Remove outer borders only */
.advanced-calendar-view .fc-theme-standard .fc-scrollgrid {
    border: none;
}

/* Light dividers for clean look */
.advanced-calendar-view .fc-col-header-cell {
    border-bottom: 1px solid var(--background-modifier-border);
    border-top: 1px solid var(--background-modifier-border);
}

.advanced-calendar-view .fc-daygrid-day {
    border-right: 1px solid var(--background-modifier-border-hover);
    border-bottom: 1px solid var(--background-modifier-border-hover);
}

.advanced-calendar-view .fc-timegrid-slot {
    border-bottom: 1px solid var(--background-modifier-border-hover);
}

.advanced-calendar-view .fc-timegrid-col {
    border-right: 1px solid var(--background-modifier-border-hover);
}

/* Header toolbar styling */
.advanced-calendar-view .fc-header-toolbar {
    padding: 0;
    border-bottom: 1px solid var(--background-modifier-border);
    background: transparent;
}

/* Calendar title styling - smaller and minimalist */
.advanced-calendar-view .fc-toolbar-title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    margin: 0;
    padding: 0.3rem 0.6rem;
}

.advanced-calendar-view .fc-toolbar-chunk {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.advanced-calendar-view .fc-toolbar.fc-header-toolbar {
    margin-bottom: 0;
}

/* Remove all borders from FullCalendar buttons */
.advanced-calendar-view .fc-button,
.advanced-calendar-view .fc-button-primary,
.advanced-calendar-view .fc-button-secondary,
.advanced-calendar-view .fc-prev-button,
.advanced-calendar-view .fc-next-button,
.advanced-calendar-view .fc-today-button,
.advanced-calendar-view .fc-dayGridMonth-button,
.advanced-calendar-view .fc-timeGridWeek-button,
.advanced-calendar-view .fc-timeGridDay-button,
.advanced-calendar-view .fc-listWeek-button {
    border: none !important;
    box-shadow: none !important;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Hover states for all FC buttons */
.advanced-calendar-view .fc-button:hover:not(:disabled),
.advanced-calendar-view .fc-button-primary:hover:not(:disabled),
.advanced-calendar-view .fc-button-secondary:hover:not(:disabled),
.advanced-calendar-view .fc-prev-button:hover:not(:disabled),
.advanced-calendar-view .fc-next-button:hover:not(:disabled) {
    background: var(--tn-interactive-hover);
    color: var(--text-normal);
    border: none !important;
    box-shadow: none !important;
}

.advanced-calendar-view .fc-button-primary:disabled {
    background: transparent;
    color: var(--text-faint);
    opacity: 0.5;
}

/* Active state for FC buttons (currently selected view) */
.advanced-calendar-view .fc-button-active,
.advanced-calendar-view .fc-button.fc-button-active {
    background: var(--interactive-accent) !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-on-accent) !important;
}

/* Use consistent button system for today button */
.advanced-calendar-view .fc-today-button {
    background: var(--interactive-accent);
    border: none;
    box-shadow: none;
    color: var(--text-on-accent);
}

.advanced-calendar-view .fc-today-button:hover:not(:disabled) {
    background: var(--interactive-accent-hover);
    box-shadow: none;
}

/* Clean today styling */
.advanced-calendar-view .fc-daygrid-day.fc-day-today {
    background: color-mix(in srgb, var(--interactive-accent) 8%, transparent) !important;
    border: 2px solid var(--interactive-accent);
    position: relative;
}

.advanced-calendar-view .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    font-weight: 600;
    color: var(--interactive-accent);
}

.advanced-calendar-view .fc-daygrid-day.fc-day-today::before {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background: var(--interactive-accent);
    border-radius: 50%;
    z-index: 1;
}

/* Header cells */
.advanced-calendar-view .fc-col-header-cell {
    background: var(--background-primary);
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
    /* text-transform: lowercase; */
    letter-spacing: 0;
    padding: 0.5rem 0.5rem;
}

/* Day numbers */
.advanced-calendar-view .fc-daygrid-day-number {
    color: var(--text-normal);
    font-weight: 400;
    font-size: 0.9rem;
    padding: 0.5rem;
}

/* Clean event styling */
.advanced-calendar-view .fc-event {
    border-radius: 6px;
    border: 1px solid;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.advanced-calendar-view .fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.advanced-calendar-view .fc-event-title {
    font-weight: 500;
    line-height: 1.3;
	text-decoration: inherit;
}

/* Time grid specific styles */
.advanced-calendar-view .fc-timegrid-slot {
    height: 3rem;
}

.advanced-calendar-view .fc-timegrid-slot-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem;
}

.advanced-calendar-view .fc-timegrid-axis {
    width: 4rem;
}


/* More events link */
.advanced-calendar-view .fc-more-link {
    color: var(--interactive-accent);
    font-size: 0.75rem;
    font-weight: 500;
}

.advanced-calendar-view .fc-more-link:hover {
    color: var(--interactive-accent-hover);
}

/* Current time indicator (red line) */
.advanced-calendar-view .fc-timegrid-now-indicator-line {
    border-color: #ff0000;
    border-width: 1px;
}

.advanced-calendar-view .fc-timegrid-now-indicator-arrow {
    border-color: #ff0000;
}

/* Mobile collapse toggle - hidden by default */
.advanced-calendar-view__mobile-toggle {
    display: none;
    padding: 0.5rem 1rem;
}

.advanced-calendar-view__collapse-btn {
    background: var(--interactive-normal);
    color: var(--text-normal);
    border: 1px solid var(--background-modifier-border);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.advanced-calendar-view__collapse-btn:hover {
    background: var(--interactive-hover);
}

/* Responsive design */
@media (max-width: 1200px) {
    .advanced-calendar-view__main-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .advanced-calendar-view__main-row .filter-bar-container {
        min-width: unset;
    }
    
    .advanced-calendar-view__controls {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    /* Show mobile toggle on small screens */
    .advanced-calendar-view__mobile-toggle {
        display: block;
    }
    
    /* Hide main row by default on mobile when collapsed */
    .advanced-calendar-view__main-row.collapsed {
        display: none;
    }
    
    .advanced-calendar-view__main-row.expanded {
        display: flex;
    }
    
    .advanced-calendar-view__controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    
    .advanced-calendar-view__schedule-tasks-btn {
        align-self: center;
    }
    
    .advanced-calendar-view__calendar-container {
        padding: 0.5rem;
    }
    
    /* Reduce header padding on mobile */
    .advanced-calendar-view__header {
        padding: 0.25rem 0.5rem;
    }
}

/* Today highlighting disabled */
.hide-today-highlight .fc-unthemed td.fc-today {
    background: inherit;
}

.hide-today-highlight .fc-daygrid-day.fc-day-today {
    background: inherit !important;
    border: none !important;
}

.hide-today-highlight .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    font-weight: 400;
    color: var(--text-normal);
}

.hide-today-highlight .fc-daygrid-day.fc-day-today::before {
    display: none;
}

.hide-today-highlight .fc-timegrid-col.fc-day-today {
    background: inherit !important;
    border: none !important;
}

/* ICS Refresh Button in FullCalendar Toolbar */
/* Use consistent button system for refresh ICS button */
.advanced-calendar-view .fc-refreshICS-button {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-normal);
    transition: all 0.2s ease;
    font-weight: normal;
    font-size: 13px;
    padding: 4px 8px;
}

.advanced-calendar-view .fc-refreshICS-button .fc-icon,
.advanced-calendar-view .fc-refreshICS-button .fc-button-label {
    color: var(--text-normal);
    font-size: 13px;
    line-height: 1.2;
    display: inline;
    visibility: visible;
}

.advanced-calendar-view .fc-refreshICS-button:hover {
    background: var(--tn-interactive-hover);
    box-shadow: none;
    color: var(--text-normal);
}

.advanced-calendar-view .fc-refreshICS-button:hover .fc-icon,
.advanced-calendar-view .fc-refreshICS-button:hover .fc-button-label {
    color: var(--text-normal);
}

.advanced-calendar-view .fc-refreshICS-button:focus {
    outline: 2px solid var(--tn-interactive-accent);
    outline-offset: 2px;
    box-shadow: none;
}

/* Ensure button content is visible and matches other FC buttons */
.advanced-calendar-view .fc-refreshICS-button,
.advanced-calendar-view .fc-refreshICS-button * {
    color: var(--text-normal);
}
